﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MockPrjTeam1.Biz;
using MockPrjTeam1.Entity;
using MockPrjTeam1.DAO;
using System.Data;
using System.Data.SqlClient;


namespace MockPrjTeam1.Pages.Views
{
    public partial class LookupContact : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var biz = new ContactBiz();

                var results = biz.GetAll();
                grvFacilityLookupContact.DataSource = results;
                grvFacilityLookupContact.DataBind();
            }
        }
        protected void PageChange(object sender, EventArgs e)
        {
            grvFacilityLookupContact.PageIndex++;
            grvFacilityLookupContact.DataBind();
        }
      
       
        public void SelectRadioButton()
        {
            Response.Redirect("../../Pages/Forms/FacilityDetail.aspx?mid={0}", false);
        }
       
        protected void grvFacilityLookupContact_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            var biz = new ContactBiz();

            var results = biz.GetAll();
            grvFacilityLookupContact.PageIndex = e.NewPageIndex;
            grvFacilityLookupContact.DataSource = results;
            grvFacilityLookupContact.DataBind();
        }

        protected void grvFacilityLookupContact_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        protected void btnSearchContact2_Click(object sender, EventArgs e)
        {
            var FirstName = Convert.ToString(txtFirstName.Text);
            var SurName = Convert.ToString(txtSurName.Text);

            var biz = new ContactBiz();
            var result = biz.SearchContact(FirstName, SurName);
            grvFacilityLookupContact.DataSource = result;
            grvFacilityLookupContact.DataBind();
        }

        protected void btnSelect_Click(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(GetType(), "id", "getSelectedItem();", true);
        }
       
    
    }
}